package com.easyOrder.service.mq;

import com.easyOrder.dao.MessageQueueRecordMapper;
import com.easyOrder.model.MessageQueueRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * Created by liutao on 2017/7/20.
 */
@Service
public class MQRecordService {

    @Autowired
    private MessageQueueRecordMapper messageQueueRecordMapper;

    /**
     * 添加消息队列日志
     * @param branchId
     * @param message
     * @param messageId
     * @param tenantId
     * @param type
     * @param userId
     * @param employeeId
     */
    public void add(Long branchId,String message,String messageId,Long tenantId,Integer type,Long userId,Long employeeId){
        MessageQueueRecord record = new MessageQueueRecord();
        record.setBranchId(branchId);
        record.setCreateTime(new Date());
        record.setMessageBody(message);
        record.setMessageId(messageId);
        record.setTenantId(tenantId);
        record.setType(type);
        record.setUserId(userId);
        record.setEmployeeId(employeeId);
        messageQueueRecordMapper.insert(record);
    }
}
